home *** CD-ROM | disk | FTP | other *** search
/ Enter 2005 May / EnterCD 5_2005.iso / Uzupelnienia / ExtendedPDF PostScript Printer 2.0 / extendedPDF PostScript Printer Installer 2.0.exe / {app} / source / ps-printer.iss (.txt) < prev   
Encoding:
Inno Setup Script  |  2004-08-24  |  5.2 KB  |  100 lines

  1. ; extendedPDF PostScript Printer Installer
  2. ; Copyright (c) JDiSoftware Limited, 2004
  3. ; Version 1.00
  4. ; This program is free software; you can redistribute it and/or modify
  5. ; it under the terms of the GNU General Public License as published by
  6. ; the Free Software Foundation; either version 2 of the License, or
  7. ; (at your option) any later version.
  8. ; This program is distributed in the hope that it will be useful,
  9. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11. ; GNU General Public License for more details.
  12. ; You should have received a copy of the GNU General Public License
  13. ; along with this program; if not, write to the Free Software
  14. ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  15. ; Comments
  16. ; ========
  17. ; The main thing this setup has to do is add the correct include directory to
  18. ; the end of the epdf.ppd PPD file, so that the SGENPRT.PPD is found correctly.
  19. ; It also serves as a way to package everything and provide installation
  20. ; instructions.
  21. [Setup]
  22. AppName=extendedPDF PostScript Printer
  23. AppVerName=extendedPDF PostScript Printer 2.0
  24. AppPublisher=JDiSoftware
  25. AppPublisherURL=http://www.jdisoftware.co.uk
  26. AppSupportURL=http://www.jdisoftware.co.uk
  27. AppUpdatesURL=http://www.jdisoftware.co.uk
  28. AppId=extendedPDF_PS_Printer
  29. DefaultDirName={pf}\JDiSoftware\extendedPDF PS Printer
  30. DefaultGroupName=JDiSoftware\extendedPDF PostScript Printer
  31. CreateAppDir=yes
  32. Compression=lzma
  33. SolidCompression=yes
  34. LicenseFile=..\jdisoftware\license.txt
  35. VersionInfoVersion=2.0.0.0
  36. InfoAfterFile=../jdisoftware/infoafter.txt
  37. PrivilegesRequired=admin
  38. [Files]
  39. ; Printer driver files
  40. Source: ..\src\extendedPDF.inf; DestDir: {app}\driver; Flags: replacesameversion;
  41. Source: ..\src\EPDF.PPD; DestDir: {app}\driver; Flags: replacesameversion;  AfterInstall: ApplyPpdInclude({app}\driver);
  42. Source: ..\src\SGENPRT.PPD; DestDir: {app}\driver; Flags: replacesameversion;
  43. Source: ..\src\COPYING.txt; DestDir: {app}; Flags: replacesameversion;
  44. Source: ..\jdisoftware\readme.html; DestDir: {app}\docs; Flags: replacesameversion;
  45. Source: ..\jdisoftware\uninstall.html; DestDir: {app}\docs; Flags: replacesameversion;
  46. Source: ..\jdisoftware\images\*.png; DestDir: {app}\docs\images; Flags: replacesameversion;
  47. ; Installer source files
  48. Source: ..\install-win32\ps-printer.iss; DestDir: "{app}\source"; Flags: replacesameversion;
  49. Source: ..\jdisoftware\infoafter.txt; DestDir: "{app}\source"; Flags: replacesameversion;
  50. Source: ..\jdisoftware\license.txt; DestDir: "{app}\source"; Flags: replacesameversion;
  51. [Icons]
  52. Name: "{group}\Installation Instructions"; Filename: {app}\docs\readme.html;
  53. Name: "{group}\Uninstallation Instructions"; Filename: {app}\docs\uninstall.html;
  54. Name: "{group}\{cm:UninstallProgram,extendedPDF PostScript Printer}"; Filename: "{uninstallexe}"
  55. [Run]
  56. Filename: rundll32.exe; Parameters: "shell32.dll,SHHelpShortcuts_RunDLL AddPrinter"; Description: "Run Add Printer Wizard"; StatusMsg: "Running Add Printer Wizard"; WorkingDir: "{app}\driver"; Flags: postinstall nowait;
  57. Filename: {app}\docs\readme.html; Description: "Display further installation instructions"; StatusMsg: "Displaying further installation instructions"; WorkingDir: "{app}"; Flags: postinstall nowait shellexec;
  58. [Code]
  59. {----------------------------------------------------------------------------}
  60.   Taken from http://www13.brinkster.com/vincenzog/isxart.asp?idart=49
  61. function GetPrinterDriverDirectory(pName: PChar;
  62.                                    pEnvironment: PChar;
  63.                                    Level: LongInt;
  64.                                    pDriverDirectory: PChar;
  65.                                    cbBuf: LongInt;
  66.                                    var pcbNeeded: LongInt): Integer;
  67. external 'GetPrinterDriverDirectoryA@winspool.drv';
  68. function GetLastError( ) : Integer;
  69. external 'GetLastError@kernel32.dll';
  70. function FindPrinterDriverDirectory(): String;
  71.   bufSize: LongInt;
  72.   driverDir: String;
  73.   err: Integer;
  74.   bufNeeded: LongInt;
  75.   str: PChar;
  76. begin
  77.   str := '';
  78.   bufSize := 0;
  79.   err := GetPrinterDriverDirectory(str, str, 1, str, bufSize, bufNeeded);
  80.   driverDir := StringOfChar(' ', bufNeeded + 1);
  81.   bufSize := bufNeeded;
  82.   err := GetPrinterDriverDirectory(str, str, 1, driverDir, bufSize, bufNeeded);
  83.   driverDir := CastIntegerToString(CastStringToInteger(driverDir));
  84.   driverDir := AddBackslash(driverDir) + '3\';
  85.   Result := driverDir;
  86. {----------------------------------------------------------------------------}
  87.   Called after the installation of EPDF.PPD into the app\driver folder.
  88.   Adds the necessary include at the end of EPDF.PPD to point to
  89.   SGENPRT.PPD.
  90. procedure ApplyPpdInclude(appPath: String);
  91.   filename: String;
  92.   driverDir: String;
  93.   newline: String;
  94. begin
  95.   filename := AddBackslash(appPath) + 'EPDF.PPD';
  96.   driverDir := FindPrinterDriverDirectory();
  97.   newline := #13 + #10;
  98.   SaveStringToFile(filename, newline + '*Include: "' + driverDir + 'SGENPRT.PPD"' + newline, True);
  99. {----------------------------------------------------------------------------}
  100.